<template>
  <div class="view-container">

    <table-search-view ref="orderView" :search-items="searchItems" :table-items="tableItems" :search-function="search">
      <template slot="action" slot-scope="scope">
        <action-compensate-info :scope="scope"></action-compensate-info>
        <action-info :scope="scope"></action-info>
      </template>
    </table-search-view>

  </div>
</template>

<script>
  import TableSearchView from '@/components/TableSearchView';

  import actionOrderInfo from './components/actionOrderInfo.vue';
  import actionCompensateInfo from './components/actionCompensateInfo.vue';

  import {getOrderCompensateOverdueList} from '@/api/order';

  export default {
    name: 'orderReturnPendingCompensate', /*赔偿逾期*/
    components: {
      'table-search-view':TableSearchView,
      'action-info':actionOrderInfo,
      'action-compensate-info':actionCompensateInfo,

    },
    data ()
    {
      return {
        searchItems: [
          {
            label: '商品名称',
            type: 'autocomplete',
            placeholder:'请输入商品名称',
            model:'goodName',
          },
          {
            label: '赔偿到期时间',
            type: 'datetimerange',
            placeholder:'请选择收货时间',
            model:'timeRange',
          },
          {
            label: '订单编号',
            type: 'input',
            placeholder:'请输入订单编号',
            model:'orderId',
          },
          {
            label: '下单用户',
            type: 'input',
            placeholder:'请输入下单用户',
            model:'userName',
          }
        ],
        tableItems:[
          {
            label:'订单编号',
            prop:'orderNumber',
            width:'180px;',
          },
          {
            label:'商品名称',
            prop:'goodsName',
            width:'180px;',
            sortable:true,
          },
          {
            label:'下单用户',
            prop:'userName',
            width:'180px;',
            sortable:true,
          },
          {
            label:'申请赔偿金额',
            prop:'compensateAmount',
            width:'160px;',
            sortable:true,
            formatter:'parsePrice',
          },
          {
            label:'逾期违约金',
            prop:'delayAmount',
            width:'160px;',
            sortable:true,
            formatter:'parsePrice',
          },
          {
            label:'赔偿到期时间',
            prop:'expireTime',
            width:'160px;',
            formatter:'parseTime',
          },
          {
            label:'赔偿状态',
            prop:'stateStr',
            width:'140px;',
            sortable:true,
          },
          {
            type:'scope',
            label:'操作',
            slot:'action',
            width:'220px;',
          },
          {

          }
        ],
      }
    },
    methods: {
      search(data)
      {
        return getOrderCompensateOverdueList(data);
        /*return new Promise(resolve => {
          let resp = {data:{total:10, list:[
            {
              "id": 96054,
              "goodsName": "nlzUvTA1Xs",
              "userName": "biYWoTkZx4",
              "compensateAmount": 45859,
              "delayAmount": 96177,
              "expireTime": 1510023376273,
              "state": "1MbpHxgxfC",
              "stateStr": "1PwbShhTAN"
            },
            {
              "id": 96754,
              "goodsName": "wOUUuknuhK",
              "userName": "GEEf87FkqD",
              "compensateAmount": 25259,
              "delayAmount": 18422,
              "expireTime": 1510021931573,
              "state": "97pGM3X1gD",
              "stateStr": "NwyHAQ8JnV"
            },
          ]}};

          resolve(resp);
        });*/
      },

    }
  }
</script>
